package com.norbitltd.guavaleaves.java.lang;

import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;

import com.google.common.base.Predicate;

public class StringPredicates extends ObjectPredicates {
	
	/**
	 * @see org.apache.commons.lang.StringUtils.equalsIgnoreCase
	 */
	public static Predicate<String> equalsIgnoreCase(final CharSequence s) {
		return new Predicate<String>() {
			public boolean apply(String arg0) {
				return StringUtils.equalsIgnoreCase(arg0, s);
			}
		};
	}
	
	public static <T extends Enum<T>> Predicate<String> isValidEnum(final Class<T> enumType) {
		return new Predicate<String>() {
			public boolean apply(String input) {
				return EnumUtils.isValidEnum(enumType, input);
			}
		};
	}
}
